https://github.com/CU-DTSC-5301-Report-JEAST/Data-Science-In-Finance-COVID-Report
In economics, an exogenous shock is a significant and unpredictable event that greatly impacts a local or global economy. An exogenous shock can be an event such as an earthquake, a flood, or the COVID-19 pandemic. When an exogenous shock occurs, governments must implement targeted policy measures to ensure the stability of the economy and the security of their citizens.
From travel and communication, to trade and supply chain expansion, our world has never been more connected than it is now and the COVID-19 pandemic was a first-of-its-kind event in modern times. In early 2020, governments all across the globe were required to react quickly to this unprecedented exogenous shock, as it significantly disrupted the established financial processes and threatened the stability of the global economy. The following analysis will investigate the various financial sector policy measures implemented at the country level and globally in the initial months of the COVID-19 pandemic.
World Bank and various COVID-19 financial response trackers maintained by entities such as the Yale Program on Financial Stability, IDB, IIF, IMF, and OECD. five primary domains: Within each of these overarching categories, a detailed breakdown into sub-categories offers a nuanced view of the specific strategies employed.
These meticulously organized sub-categories provide invaluable insights into the multifaceted policy responses implemented worldwide during the pandemic.
granular classifications, adding depth to the dataset's granularity.# importing libraries
import numpy as np
import pandas as pd
# Encoding the file
covid_data = pd.read_csv("covid-fci-data.csv", encoding = 'Latin1')
#Converting the column names to upper case
covid_data.columns = covid_data.columns.str.upper()
#examining the data set
covid_data.head()
| ID | COUNTRY NAME | COUNTRY ISO3 | INCOME LEVEL | AUTHORITY | DATE | LEVEL 1 POLICY MEASURES | LEVEL 2 POLICY MEASURES | LEVEL 3 POLICY MEASURES | DETAILS OF THE MEASURE | REFERENCE | TERMINATION DATE | MODIFICATION OF PARENT MEASURE | PARENT MEASURE | |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 0 | 1 | China | CHN | Upper middle income | SUP | 01-02-2020 | Banking sector | Operational continuity ... | Blank ... | Require banks and insurance companies to ensur... | http://www.gov.cn/zhengce/zhengceku/2020-02/03... | NaN | No | NaN |
| 1 | 2 | Canada | CAN | High income | CB | 13-03-2020 | Liquidity/funding | Liquidity (incl FX)/ELA ... | Blank ... | BoC also created a Bankers Acceptance Purchase... | https://www.bankofcanada.ca/markets/market-ope... | 31-10-2020 | No | NaN |
| 2 | 3 | China | CHN | Upper middle income | CB | 05-02-2020 | Banking sector | Integrity ... | Other integrity ... | The PBC has issued Notices on AML/CFT requirem... | ... | NaN | No | NaN |
| 3 | 4 | Thailand | THA | Upper middle income | CB | 05-02-2020 | Liquidity/funding | Policy rate ... | Blank ... | BOT cut its benchmark interest rate by 25 basi... | https://www.bot.or.th/English/PressandSpeeches... | NaN | No | NaN |
| 4 | 5 | Russian Federation | RUS | Upper middle income | CB | 07-02-2020 | Liquidity/funding | Policy rate ... | Blank ... | Policy rates were reduced by 25 basis points t... | https://www.cnbc.com/2020/02/07/reuters-americ... | NaN | No | NaN |
# re-naming the columns
covid_data.rename(columns = {'COUNTRY NAME': 'COUNTRY_NAME',
'COUNTRY ISO3': 'COUNTRY_CODE',
'INCOME LEVEL': 'INCOME_LEVEL',
'LEVEL 1 POLICY MEASURES': 'LEVEL_1_POLICY_MEASURES',
'LEVEL 2 POLICY MEASURES': 'LEVEL_2_POLICY_MEASURES',
'LEVEL 3 POLICY MEASURES': 'LEVEL_3_POLICY_MEASURES',
'DETAILS OF THE MEASURE': 'DETAILS_OF_THE_MEASURE',
'TERMINATION DATE': 'TERMINATION_DATE',
'MODIFICATION OF PARENT MEASURE': 'MODIFICATION_OF_PARENT_MEASURE',
'PARENT MEASURE': 'PARENT_MEASURE'}, inplace = True)
# examining again after re-naming the columns
covid_data.head()
| ID | COUNTRY_NAME | COUNTRY_CODE | INCOME_LEVEL | AUTHORITY | DATE | LEVEL_1_POLICY_MEASURES | LEVEL_2_POLICY_MEASURES | LEVEL_3_POLICY_MEASURES | DETAILS_OF_THE_MEASURE | REFERENCE | TERMINATION_DATE | MODIFICATION_OF_PARENT_MEASURE | PARENT_MEASURE | |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 0 | 1 | China | CHN | Upper middle income | SUP | 01-02-2020 | Banking sector | Operational continuity ... | Blank ... | Require banks and insurance companies to ensur... | http://www.gov.cn/zhengce/zhengceku/2020-02/03... | NaN | No | NaN |
| 1 | 2 | Canada | CAN | High income | CB | 13-03-2020 | Liquidity/funding | Liquidity (incl FX)/ELA ... | Blank ... | BoC also created a Bankers Acceptance Purchase... | https://www.bankofcanada.ca/markets/market-ope... | 31-10-2020 | No | NaN |
| 2 | 3 | China | CHN | Upper middle income | CB | 05-02-2020 | Banking sector | Integrity ... | Other integrity ... | The PBC has issued Notices on AML/CFT requirem... | ... | NaN | No | NaN |
| 3 | 4 | Thailand | THA | Upper middle income | CB | 05-02-2020 | Liquidity/funding | Policy rate ... | Blank ... | BOT cut its benchmark interest rate by 25 basi... | https://www.bot.or.th/English/PressandSpeeches... | NaN | No | NaN |
| 4 | 5 | Russian Federation | RUS | Upper middle income | CB | 07-02-2020 | Liquidity/funding | Policy rate ... | Blank ... | Policy rates were reduced by 25 basis points t... | https://www.cnbc.com/2020/02/07/reuters-americ... | NaN | No | NaN |
# removing the white space on both the trailing ends
covid_data['LEVEL_1_POLICY_MEASURES'] = covid_data['LEVEL_1_POLICY_MEASURES'].str.strip()
# removing the white space on both the trailing ends
covid_data['LEVEL_2_POLICY_MEASURES'] = covid_data['LEVEL_2_POLICY_MEASURES'].str.strip()
# removing the white space on the trailing ends
covid_data['INCOME_LEVEL'] = covid_data['INCOME_LEVEL'].str.strip()
# Finding out the percentage that each level_2_measure contributes with in the level_1_measure
grouping_measures = covid_data.groupby(['LEVEL_1_POLICY_MEASURES','LEVEL_2_POLICY_MEASURES'])['ID'].sum().rename("Percentage").groupby(level = 0).transform(lambda x: 100 * x/x.sum())
grouping_measures = grouping_measures.reset_index()
grouping_measures['Percentage'] = np.round(grouping_measures['Percentage'], 2) # rounding the percentage
grouping_measures
| LEVEL_1_POLICY_MEASURES | LEVEL_2_POLICY_MEASURES | Percentage | |
|---|---|---|---|
| 0 | Banking sector | Crisis management | 0.73 |
| 1 | Banking sector | Integrity | 2.72 |
| 2 | Banking sector | Operational continuity | 1.29 |
| 3 | Banking sector | Prudential | 52.98 |
| 4 | Banking sector | Support borrowers | 42.27 |
| 5 | Financial Markets/NBFI | Market functioning | 71.33 |
| 6 | Financial Markets/NBFI | NBFI | 21.79 |
| 7 | Financial Markets/NBFI | Public debt management | 6.88 |
| 8 | Insolvency | Amending bankruptcy filing obligations | 86.89 |
| 9 | Insolvency | Enhancing tools for out-of-court debt restruct... | 10.83 |
| 10 | Insolvency | Other insolvency | 2.28 |
| 11 | Liquidity/funding | Asset purchases | 9.23 |
| 12 | Liquidity/funding | Liquidity (incl FX)/ELA | 66.84 |
| 13 | Liquidity/funding | Other liquidity | 0.51 |
| 14 | Liquidity/funding | Policy rate | 23.42 |
| 15 | Payment systems | Consumer protection measures and ensuring avai... | 7.72 |
| 16 | Payment systems | Easing regulatory requirements | 10.32 |
| 17 | Payment systems | Other Payments | 11.98 |
| 18 | Payment systems | Promoting and ensuring availability of digital... | 69.98 |
grouping_measures['LEVEL_1_POLICY_MEASURES'] = grouping_measures['LEVEL_1_POLICY_MEASURES'].str.strip()
# looking at the value counts of the level_1_policy_measures column
grouping_measures['LEVEL_1_POLICY_MEASURES'].value_counts()
Banking sector 5 Liquidity/funding 4 Payment systems 4 Financial Markets/NBFI 3 Insolvency 3 Name: LEVEL_1_POLICY_MEASURES, dtype: int64
# seperating each of the policy measure into its own variable
banking = grouping_measures[grouping_measures['LEVEL_1_POLICY_MEASURES'] == 'Banking sector']
financial = grouping_measures[grouping_measures['LEVEL_1_POLICY_MEASURES'] == 'Financial Markets/NBFI']
liquidity = grouping_measures[grouping_measures['LEVEL_1_POLICY_MEASURES'] == 'Liquidity/funding']
payments = grouping_measures[grouping_measures['LEVEL_1_POLICY_MEASURES'] == 'Payment systems']
insolvency = grouping_measures[grouping_measures['LEVEL_1_POLICY_MEASURES'] == 'Insolvency']
# setting index for each of the measure for the ease of visualization plotting
banking = banking.set_index(banking['LEVEL_2_POLICY_MEASURES'])
financial = financial.set_index(financial['LEVEL_2_POLICY_MEASURES'])
liquidity = liquidity.set_index(liquidity['LEVEL_2_POLICY_MEASURES'])
payments = payments.set_index(payments['LEVEL_2_POLICY_MEASURES'])
insolvency = insolvency.set_index(insolvency['LEVEL_2_POLICY_MEASURES'])
banking
| LEVEL_1_POLICY_MEASURES | LEVEL_2_POLICY_MEASURES | Percentage | |
|---|---|---|---|
| LEVEL_2_POLICY_MEASURES | |||
| Crisis management | Banking sector | Crisis management | 0.73 |
| Integrity | Banking sector | Integrity | 2.72 |
| Operational continuity | Banking sector | Operational continuity | 1.29 |
| Prudential | Banking sector | Prudential | 52.98 |
| Support borrowers | Banking sector | Support borrowers | 42.27 |
# pip install pywaffle (to create waffle charts coz pycharts are too boring..)
from pywaffle import Waffle
import matplotlib.pyplot as plt
import pandas as pd
# Waffle subfigure
fig = plt.figure(
FigureClass = Waffle,
plots = {
# 5 figures with the axis 511, 512, 513 ...
511: {
'values': banking['Percentage'],
'labels': [f"{k} ({v} %)" for k, v in banking['Percentage'].items()], # unzipping for the labels in the legend
'legend': {'loc': 'upper left', 'bbox_to_anchor': (1.05, 1), 'fontsize': 8},
'title': {'label': 'Banking sector', 'loc': 'left', 'fontsize': 10},
'colors': ["#d55e00", "#cc79a7", "#0072b2", "#f0e442", "#009e73"] # using color blind friendly colours
},
512: {
'values': financial['Percentage'],
'labels': [f"{k} ({v} %)" for k, v in financial['Percentage'].items()],
'legend': {'loc': 'upper left', 'bbox_to_anchor': (1.05, 1), 'fontsize': 8},
'title': {'label': 'Financial Markets/NBFI', 'loc': 'left', 'fontsize': 10},
'colors': ["#232066", "#983D3D", "#DCB732"]
},
513: {
'values': insolvency['Percentage'],
'labels': [f"{k} ({v} %)" for k, v in insolvency['Percentage'].items()],
'legend': {'loc': 'upper left', 'bbox_to_anchor': (1.05, 1), 'fontsize': 8},
'title': {'label': 'Insolvency', 'loc': 'left', 'fontsize': 10},
'colors': ["#FEFE62", "#DC3220", "#E1BE6A"]
},
514: {
'values': liquidity['Percentage'],
'labels': [f"{k} ({v} %)" for k, v in liquidity['Percentage'].items()],
'legend': {'loc': 'upper left', 'bbox_to_anchor': (1.05, 1), 'fontsize': 8},
'title': {'label': 'Liquidity/funding', 'loc': 'left', 'fontsize': 10},
'cmap_name': "Dark2"
},
515: {
'values': payments['Percentage'],
'labels': [f"{k} ({v} %)" for k, v in payments['Percentage'].items()],
'legend': {'loc': 'upper left', 'bbox_to_anchor': (1.05, 1), 'fontsize': 8},
'title': {'label': 'Payment systems', 'loc': 'left', 'fontsize': 10},
'cmap_name': "Paired"
}
},
rows = 10,
figsize = (10,10),
cmap_name = "tab20b")
fig.suptitle('Breakdown of Policy measures by the Target area', fontsize = 12, fontweight = 'bold')
# plt.show()
Text(0.5, 0.98, 'Breakdown of Policy measures by the Target area')
Breakdown of Policy measures by the Target area shows the percentage of specific policy measures for all the Level - 1 policies.From the graph we can observe that
Banking Sector, the main policy actions taken were Prudential which accounts to 52.98%Prudential means careful and avoiding risksLiquidity / Funding, the main policy actions taken were Liquidity which accounts to 66.84%1.5 trillion dollors in repo operations, which refers to the selling and repurchasing of government securities.Financial Markets / NBFI, the main policy actions taken were Market Functioning which accounts to 71.33%Payment Systems, the main policy actions taken were digital payment mechanisms which accounts to 69.98%Insolvency, the main policy actions taken were Amending Bankruptcy which accounts to 86.89%This would be the most convinient method to visualize the graph. because we can easily identify the measure with he highest percentage looking the waffle graph and the visual comparision would be very easy which inturn makes it very easy for the non - technical people to understand the graph better with out any efforts
# converting from string to date type
covid_data['DATE'] = pd.to_datetime(covid_data['DATE'])
C:\Users\HP\AppData\Local\Temp\ipykernel_20772\3618321463.py:3: UserWarning: Parsing dates in DD/MM/YYYY format when dayfirst=False (the default) was specified. This may lead to inconsistently parsed dates! Specify a format to ensure consistent parsing. covid_data['DATE'] = pd.to_datetime(covid_data['DATE'])
covid_data['DATE'].dtype
dtype('<M8[ns]')
# counting number_of_measures taken by each country globally
number_of_measures_taken = covid_data.groupby(['COUNTRY_NAME'])['ID'].count()
number_of_measures_taken = number_of_measures_taken.reset_index()
number_of_measures_taken.sort_values(by = 'ID')
| COUNTRY_NAME | ID | |
|---|---|---|
| 93 | Micronesia, Fed. Sts. | 1 |
| 83 | Libya | 1 |
| 65 | Iran, Islamic Rep. | 2 |
| 37 | Djibouti | 2 |
| 66 | Iraq | 2 |
| ... | ... | ... |
| 133 | Sri Lanka | 103 |
| 74 | Korea, Rep. | 105 |
| 132 | Spain | 110 |
| 68 | Italy | 123 |
| 63 | India | 134 |
157 rows × 2 columns
# re-naming the column for better understanding
# pip install pycountry
number_of_measures_taken.rename(columns = {'ID':'TOTAL_MEASURES_COUNT'}, inplace = True)
number_of_measures_taken['COUNTRY_NAME'] = number_of_measures_taken['COUNTRY_NAME'].str.strip()
number_of_measures_taken.columns
Index(['COUNTRY_NAME', 'TOTAL_MEASURES_COUNT'], dtype='object')
# running a loop through the country names and attaching their respective country codes for the purpose of map visualization
# using 'plotly' library with choropleth.
import pycountry
def alpha3code(column):
CODE=[]
for country in column:
try:
code=pycountry.countries.get(name=country).alpha_3
# .alpha_3 means 3-letter country code
# .alpha_2 means 2-letter country code
CODE.append(code)
except:
CODE.append('None')
return CODE
# create a column for code
number_of_measures_taken['CODE']=alpha3code(number_of_measures_taken.COUNTRY_NAME)
number_of_measures_taken.head()
| COUNTRY_NAME | TOTAL_MEASURES_COUNT | CODE | |
|---|---|---|---|
| 0 | Afghanistan | 8 | AFG |
| 1 | Albania | 17 | ALB |
| 2 | Algeria | 9 | DZA |
| 3 | Angola | 5 | AGO |
| 4 | Anguilla | 4 | AIA |
# code for plotting a map visualization
import io
import plotly.express as px
np.random.seed(12)
gapminder = number_of_measures_taken
# gapminder['counts'] = np.random.uniform(low=100000, high=200000, size=len(gapminder)).tolist()
fig = px.choropleth(gapminder, locations="CODE",
locationmode='ISO-3',
color = "TOTAL_MEASURES_COUNT",
hover_name="CODE",
color_continuous_scale=px.colors.sequential.Reds)
fig.update_layout(title = {
'text': "Number of Policy Measures Initiated by each country",
'xanchor': "center",
'yanchor': "top",
'x': 0.44,
'y': 0.99,
'font_size': 20
})
fig.show()
World map shows the Number/count of Policy Measures Initiated by each country globally.India has the highest number of measures taken and the count stands at 134Libya and Micronesia has the lowest measures taken and the count stands at 1 for bothcolour density.severity of the disease as well as responsibility of the government.This would be the most convenient method to visualize the graph. because we can easily identify the state looking the map and the visual comparison would be very easy which inturn makes it very easy for the non - technical people to understand the graph better with out any efforts
# India has highest measures taken.
gapminder.sort_values(by='TOTAL_MEASURES_COUNT', ascending=False)
| COUNTRY_NAME | TOTAL_MEASURES_COUNT | CODE | |
|---|---|---|---|
| 63 | India | 134 | IND |
| 68 | Italy | 123 | ITA |
| 132 | Spain | 110 | ESP |
| 74 | Korea, Rep. | 105 | None |
| 133 | Sri Lanka | 103 | LKA |
| ... | ... | ... | ... |
| 119 | Samoa | 2 | WSM |
| 129 | Solomon Islands | 2 | SLB |
| 51 | Gambia, The | 2 | None |
| 83 | Libya | 1 | LBY |
| 93 | Micronesia, Fed. Sts. | 1 | None |
157 rows × 3 columns
# Inspecting when is the first date that a particular country started taking measure and when did they stop and when was the
# last measure taken
country_frame = covid_data.groupby(['COUNTRY_NAME'])
country_frame = country_frame.agg(Minimum_Date=('DATE', np.min), Maximum_Date=('DATE', np.max))
country_frame
| Minimum_Date | Maximum_Date | |
|---|---|---|
| COUNTRY_NAME | ||
| Afghanistan | 2020-05-27 | 2020-09-04 |
| Albania | 2020-01-04 | 2020-12-03 |
| Algeria | 2020-03-15 | 2020-06-04 |
| Angola | 2020-03-04 | 2020-10-05 |
| Anguilla | 2020-03-04 | 2020-03-27 |
| ... | ... | ... |
| Uzbekistan | 2020-03-04 | 2021-11-03 |
| Vietnam | 2020-03-17 | 2020-12-05 |
| West Bank and Gaza | 2020-03-27 | 2020-09-03 |
| Zambia | 2020-01-04 | 2020-05-20 |
| Zimbabwe | 2020-01-05 | 2021-01-02 |
157 rows × 2 columns
covid_data.head(2)
| ID | COUNTRY_NAME | COUNTRY_CODE | INCOME_LEVEL | AUTHORITY | DATE | LEVEL_1_POLICY_MEASURES | LEVEL_2_POLICY_MEASURES | LEVEL_3_POLICY_MEASURES | DETAILS_OF_THE_MEASURE | REFERENCE | TERMINATION_DATE | MODIFICATION_OF_PARENT_MEASURE | PARENT_MEASURE | |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 0 | 1 | China | CHN | Upper middle income | SUP | 2020-01-02 | Banking sector | Operational continuity | Blank ... | Require banks and insurance companies to ensur... | http://www.gov.cn/zhengce/zhengceku/2020-02/03... | NaN | No | NaN |
| 1 | 2 | Canada | CAN | High income | CB | 2020-03-13 | Liquidity/funding | Liquidity (incl FX)/ELA | Blank ... | BoC also created a Bankers Acceptance Purchase... | https://www.bankofcanada.ca/markets/market-ope... | 31-10-2020 | No | NaN |
# grouping the countries with respect to income class level
classes = covid_data.groupby(['COUNTRY_NAME','INCOME_LEVEL','LEVEL_1_POLICY_MEASURES','AUTHORITY'])['ID'].count()
classes = classes.reset_index()
classes
| COUNTRY_NAME | INCOME_LEVEL | LEVEL_1_POLICY_MEASURES | AUTHORITY | ID | |
|---|---|---|---|---|---|
| 0 | Afghanistan | Low income | Banking sector | CB | 5 |
| 1 | Afghanistan | Low income | Liquidity/funding | CB | 1 |
| 2 | Afghanistan | Low income | Payment systems | CB | 2 |
| 3 | Albania | Upper middle income | Banking sector | CB | 9 |
| 4 | Albania | Upper middle income | Banking sector | GOV | 1 |
| ... | ... | ... | ... | ... | ... |
| 850 | Zimbabwe | Lower middle income | Banking sector | GOV | 8 |
| 851 | Zimbabwe | Lower middle income | Financial Markets/NBFI | GOV | 1 |
| 852 | Zimbabwe | Lower middle income | Financial Markets/NBFI | SUP | 1 |
| 853 | Zimbabwe | Lower middle income | Liquidity/funding | CB | 12 |
| 854 | Zimbabwe | Lower middle income | Payment systems | MoF | 1 |
855 rows × 5 columns
# There are two same values with difference in the capitalization
classes['INCOME_LEVEL'].value_counts()
Upper middle income 284 High income 276 Lower middle income 200 Low income 87 Upper Middle Income 4 Aggregates 4 Name: INCOME_LEVEL, dtype: int64
# renaming the value so that duplicate categories can be avoided
classes['INCOME_LEVEL'] = classes['INCOME_LEVEL'].str.replace('Upper Middle Income','Upper middle income')
# inspecting after renaming
classes['INCOME_LEVEL'].value_counts()
Upper middle income 288 High income 276 Lower middle income 200 Low income 87 Aggregates 4 Name: INCOME_LEVEL, dtype: int64
# removing the authority as it has less significance
income_levels = classes.groupby(['INCOME_LEVEL','LEVEL_1_POLICY_MEASURES'])['ID'].count().rename("PERCENTAGE").groupby(level = 0).transform(lambda x: 100 * x/x.sum())
income_levels = income_levels.reset_index()
income_levels
| INCOME_LEVEL | LEVEL_1_POLICY_MEASURES | PERCENTAGE | |
|---|---|---|---|
| 0 | Aggregates | Banking sector | 50.000000 |
| 1 | Aggregates | Financial Markets/NBFI | 25.000000 |
| 2 | Aggregates | Insolvency | 25.000000 |
| 3 | High income | Banking sector | 48.188406 |
| 4 | High income | Financial Markets/NBFI | 21.376812 |
| 5 | High income | Insolvency | 6.521739 |
| 6 | High income | Liquidity/funding | 14.492754 |
| 7 | High income | Payment systems | 9.420290 |
| 8 | Low income | Banking sector | 34.482759 |
| 9 | Low income | Financial Markets/NBFI | 13.793103 |
| 10 | Low income | Liquidity/funding | 28.735632 |
| 11 | Low income | Payment systems | 22.988506 |
| 12 | Lower middle income | Banking sector | 42.500000 |
| 13 | Lower middle income | Financial Markets/NBFI | 14.500000 |
| 14 | Lower middle income | Insolvency | 4.000000 |
| 15 | Lower middle income | Liquidity/funding | 22.000000 |
| 16 | Lower middle income | Payment systems | 17.000000 |
| 17 | Upper middle income | Banking sector | 44.097222 |
| 18 | Upper middle income | Financial Markets/NBFI | 20.486111 |
| 19 | Upper middle income | Insolvency | 4.861111 |
| 20 | Upper middle income | Liquidity/funding | 19.444444 |
| 21 | Upper middle income | Payment systems | 11.111111 |
# pip install plotly
import warnings
# to disable if there are any warnings
warnings.filterwarnings("ignore")
# plotting a spyder/radar chart for different levels of income classes to look into what measures were taken the most in their
# respective classes.
import plotly.express as px
import time
t1 = time.time()
fig = px.line_polar(income_levels, r='PERCENTAGE', theta='LEVEL_1_POLICY_MEASURES', color='INCOME_LEVEL', line_close=True, template="plotly_dark")
fig.update_traces(fill="toself")
fig.update_layout(title = {
'text': "Target Area Breakdown by Income Level",
'xanchor': "center",
'yanchor': "top",
'x': 0.44,
'y': 0.99,
'font_size': 20
})
fig.show()
t2 = time.time()
print(t2-t1) # total processing time
# changed the theme colour for good vision purposes.
0.20844483375549316
spyder chart or radial chart shows the Target area breakdown by Income Level for all the countries in the world.percentage that each Income Level contributes to the target area.Low Income Countries are prefering Liquidity because it is obvious that low income countries in general do not have any cash available instantaneously.Banking Sector measures were taken the most among all categories of countries.Insolvency were not taken by any category of the countries which is interesting.curves intersecting each and every categorical lines.This would be the most convinient method to visualize the graph because we can easily identify the percentage of the measures for countries with different income categories looking at the graph and the visual comparision would be very easy which inturn makes it very easy for the non - technical people to understand the graph better with out any efforts
# Quantitative Analysis......
# Created a new table from the existing data set using 'R' language and wriiten that to a new csv file in order to
# get Quantitative data since the previous data set has only Qualitative columns.
# reading the newly created file with absolute path
# This file is created such that the count of measures taken by each country in a particular month in the year 2020.
covid_pol_cat = pd.read_csv(r"C:\Users\HP\Downloads\GroupProject_VisualizingCOVIDEconomicData2\GroupProject_VisualizingCOVIDEconomicData\data\covid-pol-count-country-month.csv")
covid_pol_cat
| Country Name | Month | Banking sector | Liquidity/funding | Payment systems | Financial Markets/NBFI | Insolvency | |
|---|---|---|---|---|---|---|---|
| 0 | Afghanistan | 4 | 5 | 1 | 0 | 0 | 0 |
| 1 | Afghanistan | 5 | 0 | 0 | 2 | 0 | 0 |
| 2 | Albania | 3 | 3 | 2 | 0 | 0 | 0 |
| 3 | Albania | 4 | 1 | 0 | 2 | 1 | 0 |
| 4 | Albania | 5 | 5 | 0 | 0 | 0 | 1 |
| ... | ... | ... | ... | ... | ... | ... | ... |
| 730 | Zimbabwe | 3 | 2 | 4 | 0 | 1 | 0 |
| 731 | Zimbabwe | 4 | 1 | 2 | 0 | 0 | 0 |
| 732 | Zimbabwe | 5 | 7 | 2 | 0 | 0 | 0 |
| 733 | Zimbabwe | 6 | 0 | 2 | 1 | 1 | 0 |
| 734 | Zimbabwe | 7 | 0 | 1 | 0 | 0 | 0 |
735 rows × 7 columns
# getting count for the famous countries
covid_uk_pol_cat = covid_pol_cat[covid_pol_cat["Country Name"]=="United Kingdom"]
covid_us_pol_cat = covid_pol_cat[covid_pol_cat["Country Name"]=="United States"]
covid_bra_pol_cat = covid_pol_cat[covid_pol_cat["Country Name"]=="Brazil"]
covid_ind_pol_cat = covid_pol_cat[covid_pol_cat["Country Name"]=="India"]
covid_jap_pol_cat = covid_pol_cat[covid_pol_cat["Country Name"]=="Japan"]
covid_uk_pol_cat
| Country Name | Month | Banking sector | Liquidity/funding | Payment systems | Financial Markets/NBFI | Insolvency | |
|---|---|---|---|---|---|---|---|
| 690 | United Kingdom | 3 | 10 | 6 | 0 | 1 | 3 |
| 691 | United Kingdom | 4 | 10 | 4 | 1 | 0 | 1 |
| 692 | United Kingdom | 5 | 9 | 1 | 1 | 1 | 0 |
| 693 | United Kingdom | 6 | 1 | 1 | 2 | 1 | 1 |
| 694 | United Kingdom | 7 | 5 | 0 | 0 | 0 | 0 |
| 695 | United Kingdom | 8 | 1 | 1 | 1 | 0 | 0 |
| 696 | United Kingdom | 9 | 4 | 0 | 0 | 1 | 0 |
| 697 | United Kingdom | 10 | 2 | 0 | 0 | 1 | 0 |
| 698 | United Kingdom | 11 | 2 | 0 | 0 | 0 | 0 |
| 699 | United Kingdom | 12 | 2 | 0 | 0 | 0 | 0 |
# Profile of Economic policy types in the USA from March-December 2020
plt.stackplot(covid_us_pol_cat["Month"],
covid_us_pol_cat["Banking sector"],
covid_us_pol_cat["Liquidity/funding"],
covid_us_pol_cat["Payment systems"],
covid_us_pol_cat["Financial Markets/NBFI"],
covid_us_pol_cat["Insolvency"],
labels=list(covid_us_pol_cat.columns)[2:])
plt.legend()
plt.xticks(covid_us_pol_cat["Month"],["Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"])
plt.title("Profile of Economic policy types in the USA from March-December 2020")
Text(0.5, 1.0, 'Profile of Economic policy types in the USA from March-December 2020')
# Profile of Economic policy types in India from February-December 2020
plt.stackplot(covid_ind_pol_cat["Month"],
covid_ind_pol_cat["Banking sector"],
covid_ind_pol_cat["Liquidity/funding"],
covid_ind_pol_cat["Payment systems"],
covid_ind_pol_cat["Financial Markets/NBFI"],
covid_ind_pol_cat["Insolvency"],
labels=list(covid_ind_pol_cat.columns)[2:])
plt.legend()
plt.xticks(covid_ind_pol_cat["Month"],["Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"])
plt.title("Profile of Economic policy types in India from February-December 2020")
Text(0.5, 1.0, 'Profile of Economic policy types in India from February-December 2020')
area graphs illustrates the aggregate of policy measures taken in the initial months in US and India respectively.color represents one category out of all five targeted areas.From the graph we can observe that
India had more policy measures related to financial markets and nonbank financial institutions than the US during the year 2020.largest target area was the banking sector for both the countries but the second largest in USA is liquidity/funding, however in India it was financial markets or non-banking financial institutes.India first drop off in policy count accrued in May whereas in the USA the first drop-off occurred in April.sharper in India in May whereas in you the policy count was tapered down throughout the summer (i.e. Apr, May, Jun, July)colors assigned to each targeted area.This chart would be the most convenient method to analyze how the policy counts under different targeted areas changes over time using different colors. This way we can also compare the policy count change among the countries just to see how different government responded to COVID-19 in terms of economic measures.
# Monthy Global Economic Policy by Category in the year 2020
covid_international_pol = covid_pol_cat.groupby(["Month"]).sum()
plt.stackplot(list(np.arange(12)),
covid_international_pol["Banking sector"],
covid_international_pol["Liquidity/funding"],
covid_international_pol["Payment systems"],
covid_international_pol["Financial Markets/NBFI"],
covid_international_pol["Insolvency"],
labels=list(covid_international_pol.columns))
plt.legend()
plt.xticks(list(np.arange(12)),["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"])
plt.title("Monthy Global Economic Policy by Category in the year 2020")
Text(0.5, 1.0, 'Monthy Global Economic Policy by Category in the year 2020')
stacked area charts represent the number of policy changes enacted by month for the given countries, and the world as a whole.early March, essentially reflecting a flurry of economic policy activity during the initial wave of the COVID pandemic.India saw a resurgence in economic policy changes during the months of August and September. This is likely due to those countries choosing to loosen COVID restrictions during these months.transition to online and remote payment systems. Noteably, the US did not enact any specific policies regarding incentivizing online payment systems, likely because such systems were already widespread before the onset of COVID.This would be the most convinient method to visualize the graph because we can easily identify the number of the policy measures taken for all the countries in a particular year, and looking at the graph, the visual comparision would be very easy which inturn makes it very easy for the non - technical people to understand the graph better with out any efforts
With regards to the financial-policies data visualizations, there are two main possible sources of error. The first is an error in economic reporting from the countries who enacted these policies. Many countries might have made economic policies in secret, or in such a way that they were not widely reported and were not added to this data-set by the people compiling it. The second source of error is human error on the part of the group who compiled this data. It is possible that they miscategorized economic policies, or simply ran up against economic policies which did not cleanly fit into (just) a single category.
Finally, there is the fact that the economic policies listed included extensions of existing policy, implementations of new policy, and retractions of old policies. This means that the running policy count in these charts is for the total activity (in terms of number of policies altered) associated with economic policies of a particular category, not a running count of the total number of active economic policies.
The COVID-19 pandemic was an unprecedented exogenous shock that required immediate policy implementation targeted to the financial sector in order to stabilize the economy. Our analysis found that globally, the highest frequency of policy actions were during the first few months of COVID-19 in 2020, and tapered off a bit during the summer months. Specifically, the most common policy target areas overall were found to be the banking sector and liquidity/funding. The three remaining target areas, which comprise of payment systems, financial markets and nonbank financial institutions, and insolvency, saw significantly less policy action.
When broken down to the country level, we did not necessarily find the same trends as the overall global trend. Specifically, looking at the data for India’s policy measures, their largest target areas were the banking sector and financial markets/nonbank financial institutions. Interestingly, India also had the highest policy measure count of any country. On the other hand, the US more closely mimicked the global data as far as counts go, with the highest number of policy measures targeted to the banking sector and liquidity/funding. We also found that the key target areas differed by income level. Higher income countries tended to target the banking sector more frequently, whereas lower income countries frequently targeted liquidity/funding and payment systems.
These findings not only demonstrate the urgency of implementing financial policy measures to mitigate the COVID-19 pandemic, but that the needs of each country differ significantly depending on their existing economies and situations. While we are able to see a global trend, the trends of each individual economy vary as they each have different needs. While one policy measure may work for a particular country, it might not for another. This underscores the necessity of utilizing informed, data-driven analyses to guide financial policy implementation during an economic crisis.